The member [class] has no supported translation to SQL

Posted by Code Sherpa on Stack Overflow See other posts from Stack Overflow or by Code Sherpa
Published on 2010-05-23T21:59:42Z Indexed on 2010/05/23 22:00 UTC
Read the original article Hit count: 165

Filed under:
|
|

Hi, I am getting the following error:

Error Message:The member 'Company.ProductCore.Core.Domain.Account.Email' has no supported translation to SQL.

My method looks like this:

public Account GetAccountByEmail(string email)
        {
            Account account;

            using (WorkbookDataContext dc = _conn.GetContext())
            {
                account = ( from a in dc.Accounts
                            join em in dc.Emails on a.AccountId equals em.AccountId
                            where a.Email.EmailAddress == email
                            select a).FirstOrDefault();
            }

            return account;

        }

My Account class has a getter / setter that exposes Email:

 public Email Email
        {
            get { return _email; }
            set { _email = value; }
        }

And my Email is a LINQ object.

I have a feeling that the problem is that I am using a LINQ object for me Email property? I am new to LINQ and am not really sure why this is happening.

Help appreciated, thanks...

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET